package com.woniu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniu.entity.PageData;
import com.woniu.entity.dto.QueryUserFeedBackDTO;
import com.woniu.entity.vo.UserFeedBackVo;
import com.woniu.mapper.UserFeedbackMapper;
import com.woniu.pojo.*;
import com.woniu.service.UserFeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
* @author Ma.Lei
* @description 针对表【t_user_feedback】的数据库操作Service实现
* @createDate 2022-12-16 23:28:31
*/
@Service
public class UserFeedbackServiceImpl extends ServiceImpl<UserFeedbackMapper, UserFeedback> implements UserFeedbackService {

    @Autowired
    private UserFeedbackMapper userFeedbackMapper;

    @Override
    public PageData listSearch(Integer currentPage, Integer pageSize, QueryUserFeedBackDTO queryUserFeedBackDTO) {

        // 2. 构建分页参数
        IPage<UserFeedBackVo> page = new Page<>(currentPage, pageSize);
        // 3. roadMapper
        IPage<UserFeedBackVo> userFeedBackVoIPage = userFeedbackMapper.selectPageUser(page,queryUserFeedBackDTO);
        // 4. 组装返回数据对象
        PageData pageData = new PageData(userFeedBackVoIPage.getTotal(), userFeedBackVoIPage.getRecords());
        // 5. 返回数据
        return pageData;
    }

    @Override
    public User getByUser(String id) {
        return userFeedbackMapper.getByUser(id);
    }
}




